package com.globallogic.learning.kozius.actor;

/**
 * Class aggregates contact information of a people
 * <p/>
 * Created by sergii.koziumynskyi on 2/4/14.
 */
public final class Contact {
    public Contact(String street, String city, String phone, boolean isWork) {
        this.street = street;
        this.city = city;
        this.phone = phone;
        this.isWork = isWork;
    }

    public Contact(String street, String city, String phone) {
        this.street = street;
        this.city = city;
        this.phone = phone;
    }

    public Contact() {
    }

    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public boolean isWork() {
        return isWork;
    }

    public void setType(boolean isWork) {
        this.isWork = isWork;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Contact contact = (Contact) o;

        if (isWork != contact.isWork) return false;
        if (city != null ? !city.equals(contact.city) : contact.city != null) return false;
        if (phone != null ? !phone.equals(contact.phone) : contact.phone != null) return false;
        if (street != null ? !street.equals(contact.street) : contact.street != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = street != null ? street.hashCode() : 0;
        result = 31 * result + (city != null ? city.hashCode() : 0);
        result = 31 * result + (phone != null ? phone.hashCode() : 0);
        result = 31 * result + (isWork ? 1 : 0);
        return result;
    }

    @Override
    public String toString() {
        return "street='" + street + '\'' +
                ", city='" + city + '\'' +
                ", phone='" + phone + '\'' + ".";
    }

    private String street = "";
    private String city = "";
    private String phone = "";
    private boolean isWork;

}
